#include"graphic_lib.h"

graphic_data_struct_t* graphic_draw_line(graphic_data_struct_t* data, uint32_t width, const graphic_point start_point, const graphic_point end_point) {
    data->graphic_tpye=0;
    data->width = width;
    data->start_x = start_point.x;
    data->start_y = start_point.y;
    data->end_x = end_point.x;
    data->end_y = end_point.y;
    return data;
}
graphic_data_struct_t* graphic_draw_rect(graphic_data_struct_t* data, uint32_t width, const graphic_point start_point, const graphic_point end_point) {
    data->graphic_tpye=1;
    data->width = width;
    data->start_x = start_point.x;
    data->start_y = start_point.y;
    data->end_x = end_point.x;
    data->end_y = end_point.y;
    return data;
}
graphic_data_struct_t* graphic_draw_circle(graphic_data_struct_t* data, uint32_t width, const graphic_point centre_point, uint32_t radius) {
    data->graphic_tpye=2;
    data->width = width;
    data->start_x = centre_point.x;
    data->start_y = centre_point.y;
    data->radius = radius;
    return data;
}

graphic_data_struct_t* graphic_draw_ellipse(graphic_data_struct_t* data, uint32_t width, const graphic_point centre_point, const graphic_point semi_axis) {
    data->graphic_tpye=3;
    data->width = width;
    data->start_x = centre_point.x;
    data->start_y = centre_point.y;
    data->end_x = semi_axis.x;
    data->end_y = semi_axis.y;
    return data;
}
graphic_data_struct_t* graphic_draw_arc(graphic_data_struct_t* data, uint32_t start_angle, uint32_t end_angle, uint32_t width, const graphic_point centre_point, const graphic_point semi_axis) {
    data->graphic_tpye=4;
    data->width = width;
    data->start_angle = start_angle;
    data->end_angle = end_angle;
    data->start_x = centre_point.x;
    data->start_y = centre_point.y;
    data->end_x = semi_axis.x;
    data->end_y = semi_axis.y;
    return data;
}
graphic_data_struct_t* graphic_draw_float(graphic_data_struct_t* data, uint32_t size, uint32_t precision, uint32_t width, const graphic_point start_point, fp32 number) {
    data->graphic_tpye=5;
    data->start_angle = size;
    data->end_angle = precision;
    data->start_x = start_point.x;
    data->start_y = start_point.y;
    data->width = width;
    data->radius = (int32_t)(number * 1000.0f);
    return data;
}

graphic_data_struct_t* graphic_draw_integer(graphic_data_struct_t* data, uint32_t size, uint32_t width, const graphic_point start_point, int32_t number) {
    data->graphic_tpye=6;
    data->start_angle = size;
    data->start_x = start_point.x;
    data->start_y = start_point.y;
    data->width = width;
    data->radius = number;
    return data;
}
graphic_data_struct_t* graphic_draw_char(graphic_data_struct_t* data, uint32_t size, uint32_t length, uint32_t width, const graphic_point start_point) {
    data->graphic_tpye=7;
    data->start_angle = size;
    data->end_angle = length;
    data->start_x = start_point.x;
    data->start_y = start_point.y;
    data->width = width;
    return data;
}

graphic_data_struct_t* graphic_data_set_inf(graphic_data_struct_t* data, uint32_t id, Graphic_OP op, uint32_t layer, Graphic_Color color) {
    uint32_t* ptr = (uint32_t*)(&data->graphic_name[0]);
    *ptr = id;
    data->operate_tpye = op;
    data->layer = layer;
    data->color = color;
    return data;
}

graphic_data_struct_t* graphic_data_set_blank(graphic_data_struct_t* data){
    data->operate_tpye=Graphic_OP_Blank;
}
